import clc from 'cli-color';

export class Logger {
  /*
   * @description 日志输出
   * @param message 日志内容
   * @param context 日志上下文
   */
  static log(message: string, context: string = '') {
    // 获取当前时间戳
    const timestamp = new Date().toLocaleString();

    // 获取当前进程id
    const pid = process.pid;
    console.log(
      `[${clc.green('Nest')}] ${clc.green(pid.toString())} - ${clc.yellow(timestamp)} ${clc.green('LOG')} [${clc.yellow(context)}] ${clc.green(message)}`,
    );
  }
}
